from selenium.webdriver.common.by import By

from utils.page_base import PageBase

class PageForm(PageBase):
    url="/webzdh/form.html"
    loc_zanhao=By.ID,"username"
    loc_pwd=By.ID,"pwd"
    loc_sex="sex"
    loc_guoji="guoji"
    loc_aihao="aihao"
    loc_degree="degree"
    loc_jiesao=By.ID,"jiesao"
    loc_zaopian=By.ID,"zaopian"
    loc_birthday=By.ID,"birthday"
    loc_regButton=By.CSS_SELECTOR,"input[value='注册']"

    def __init__(self,driver,base_url):
        PageBase.__init__(self,driver,base_url)


    def openUrl(self):
        self.open(PageForm.url)

    def input_zanhao(self,zanhao):
        self.clearAndInput(PageForm.loc_zanhao,zanhao)

    def input_pwd(self,pwd):
        self.clearAndInput(PageForm.loc_pwd,pwd)

    def input_sex(self,sex):#"M"
        self.selectRaidoOption(PageForm.loc_sex,sex)

    def input_guoji(self,guoji):#"zonguo"
        self.selectRaidoOption(PageForm.loc_guoji,guoji)

    def input_aihao(self,aihaoValue):#"dalanqiu,tizuqiu"
        self.selectCheckBoxOptions(PageForm.loc_aihao,aihaoValue)

    def input_degree(self,degree):#"本科"
        self.selectSelectOption(PageForm.loc_degree,degree)

    def input_jiesao(self,jiesao):#"你好啊我是张三"
        self.clearAndInput(PageForm.loc_jiesao,jiesao)

    def uoloadZaoPian(self,zaopian):#"C:/A/1.png,C:/A/2.png"
        self.uploadFiles2(PageForm.loc_zaopian,zaopian)

    def input_birthday(self,riqi):
        self.date_input(PageForm.loc_birthday,riqi)


    def click_regButton(self):
        self.mouse_click(PageForm.loc_regButton)